package edu.arizona.sista.learn.model.groups;

/**
 * A simple model of a body part, which is a thing and typically
 * belongs to a person.
 * 
 * @author Anh Tran
 *
 */
public class BodyPart extends Thing {
	
	private Person _owner;
	
	public static enum BodyPartName {
		
		Head,
		Chest,
		ElbowLeft,
		ElbowRight,
		HandLeft,
		HandRight,
		KneeLeft,
		KneeRight,
		FootLeft,
		FootRight;
		
		public static BodyPartName fromString(String s) {
		    if (s != null) {
		      for (BodyPartName b : BodyPartName.values()) {
		        if (s.equalsIgnoreCase(b.toString())) {
		          return b;
		        }
		      }
		    }
		    return null;
		}
	}

	public BodyPart(BodyPartName n, Person owner) {
		super(n.toString());
		_owner = owner;
	}
	
	public Person owner() {
		return _owner;
	}

	@Override
	public String toString() {
		return "{" + this.id() + ":" + this.owner().name() + "." + this.name() + "}";
	}
}
